Optimal. Leaf size=69 \[ \frac{b (2 a-b) \tan ^3(e+f x)}{3 f}+\frac{(a-b)^2 \tan (e+f x)}{f}-x (a-b)^2+\frac{b^2 \tan ^5(e+f x)}{5 f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0737361, antiderivative size = 69, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.13, Rules used = {3670, 461, 203} \[ \frac{b (2 a-b) \tan ^3(e+f x)}{3 f}+\frac{(a-b)^2 \tan (e+f x)}{f}-x (a-b)^2+\frac{b^2 \tan ^5(e+f x)}{5 f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3670
Rule 461
Rule 203
Rubi steps
\begin{align*} \int \tan ^2(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac{\operatorname{Subst}\left (\int \frac{x^2 \left (a+b x^2\right )^2}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{\operatorname{Subst}\left (\int \left ((a-b)^2+(2 a-b) b x^2+b^2 x^4+\frac{-a^2+2 a b-b^2}{1+x^2}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{(a-b)^2 \tan (e+f x)}{f}+\frac{(2 a-b) b \tan ^3(e+f x)}{3 f}+\frac{b^2 \tan ^5(e+f x)}{5 f}-\frac{(a-b)^2 \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-(a-b)^2 x+\frac{(a-b)^2 \tan (e+f x)}{f}+\frac{(2 a-b) b \tan ^3(e+f x)}{3 f}+\frac{b^2 \tan ^5(e+f x)}{5 f}\\ \end{align*}
Mathematica [A] time = 0.0560561, size = 137, normalized size = 1.99 \[ -\frac{a^2 \tan ^{-1}(\tan (e+f x))}{f}+\frac{a^2 \tan (e+f x)}{f}+\frac{2 a b \tan ^3(e+f x)}{3 f}+\frac{2 a b \tan ^{-1}(\tan (e+f x))}{f}-\frac{2 a b \tan (e+f x)}{f}+\frac{b^2 \tan ^5(e+f x)}{5 f}-\frac{b^2 \tan ^3(e+f x)}{3 f}-\frac{b^2 \tan ^{-1}(\tan (e+f x))}{f}+\frac{b^2 \tan (e+f x)}{f} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.004, size = 132, normalized size = 1.9 \begin{align*}{\frac{{b}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{5}}{5\,f}}+{\frac{2\, \left ( \tan \left ( fx+e \right ) \right ) ^{3}ab}{3\,f}}-{\frac{{b}^{2} \left ( \tan \left ( fx+e \right ) \right ) ^{3}}{3\,f}}+{\frac{{a}^{2}\tan \left ( fx+e \right ) }{f}}-2\,{\frac{\tan \left ( fx+e \right ) ab}{f}}+{\frac{{b}^{2}\tan \left ( fx+e \right ) }{f}}-{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ){a}^{2}}{f}}+2\,{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) ab}{f}}-{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ){b}^{2}}{f}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.61744, size = 103, normalized size = 1.49 \begin{align*} \frac{3 \, b^{2} \tan \left (f x + e\right )^{5} + 5 \,{\left (2 \, a b - b^{2}\right )} \tan \left (f x + e\right )^{3} - 15 \,{\left (a^{2} - 2 \, a b + b^{2}\right )}{\left (f x + e\right )} + 15 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )}{15 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.09442, size = 177, normalized size = 2.57 \begin{align*} \frac{3 \, b^{2} \tan \left (f x + e\right )^{5} + 5 \,{\left (2 \, a b - b^{2}\right )} \tan \left (f x + e\right )^{3} - 15 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} f x + 15 \,{\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )}{15 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 0.731504, size = 117, normalized size = 1.7 \begin{align*} \begin{cases} - a^{2} x + \frac{a^{2} \tan{\left (e + f x \right )}}{f} + 2 a b x + \frac{2 a b \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac{2 a b \tan{\left (e + f x \right )}}{f} - b^{2} x + \frac{b^{2} \tan ^{5}{\left (e + f x \right )}}{5 f} - \frac{b^{2} \tan ^{3}{\left (e + f x \right )}}{3 f} + \frac{b^{2} \tan{\left (e + f x \right )}}{f} & \text{for}\: f \neq 0 \\x \left (a + b \tan ^{2}{\left (e \right )}\right )^{2} \tan ^{2}{\left (e \right )} & \text{otherwise} \end{cases} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 2.82322, size = 1265, normalized size = 18.33 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]